package demo6Lianxi20250331;
/*
* 反射机制可以破除单例模式(需谨慎)
* */

import java.lang.reflect.Constructor;

public class Demo3 {
    public static void main(String[] args) throws Exception {
        Class cls = Class.forName("demo6Lianxi20250331.Student");
        Constructor declaredConstructor = cls.getDeclaredConstructor();
        declaredConstructor.setAccessible(true);
        Object o1 = declaredConstructor.newInstance();
        Object o2 = declaredConstructor.newInstance();
        System.out.println(o1);
        System.out.println(o2);
    }
}
